<!--  -->
<template>
<div class=''></div>
</template>

<script>

import website from '@framework-core/config/website';
import request from '@/framework-core/axios';
import {
  mapGetters
} from "vuex";

export default {
  methods: {
    cas: function() {
      let params = {"token":this.$route.query.ticket};
      request.get(website.baseUrl + '/api/cas/exchange-token', {params:params}).then(response => {
        this.$store.dispatch("LoginByCasToken", response).then(() => {
          let toUrl = this.$route.query.toUrl
          if (toUrl) {
            this.$router.push(toUrl)
          } else {
            this.$router.push("/")
          }
        })
        //this.$store.dispatch('LoginByCasToken', {token: response})

      }).catch(error => {
        this.$message.error(error.msg)
      })
      console.info(this.$route.query.ticket)
    }
  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    this.cas()
  }
}
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类

</style>
